/**
 * Created by jaliu on 2015/3/15.
 */
module.exports = function (app) {
    var voucher = require('../../controllers/backoffice/backOffice-voucher-controller');
    var rewardRule = require('../../controllers/backoffice/backOffice-rewardrule-controller');
    var invoiceRetailer = require('../../controllers/backoffice/backOffice-invoiceRetailer-controller');

    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/addVoucherType', voucher.addVoucherType);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getVoucherType', voucher.getVoucherType);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/addRetailer', voucher.addRetailer);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/addMainRetailer', voucher.addMainRetailer);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getRetailerList/:parentId', voucher.getRetailerList);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/bindRetailerCommunity', voucher.bindRetailerCommunity);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getRetailerList/all', voucher.getAllRetailers);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getRetailerAgreement/:retailerId', voucher.getRetailerAgreement);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/addRetailerAgreement', voucher.addRetailerAgreement);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/deleteAgreement/:id', voucher.deleteAgreement);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getAgreementVoucher', voucher.getAgreementVoucher);
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getBranchRetailer/:communityId/:page', voucher.getBranchRetailer);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/singleBindRetailer', voucher.singleBindRetailer);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/searchRetailerByName', voucher.searchRetailerByName);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/RetailerExchangeList', voucher.getRetailerExchangeList);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getRetailerSettlement', voucher.getRetailerSettlement);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/retailerBalance', voucher.retailerBalance);

    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getVoucherStatistics', voucher.getVoucherStatistics);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getConsumeStatistics', voucher.getConsumeStatistics);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/getIsSettlementProfile', voucher.getIsSettlementProfile);

    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/searchVoucher/:page', voucher.searchVoucher);

    //reward rule
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/rewardRule', rewardRule.addRewardRule)
    app.put('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/rewardRule', rewardRule.updateRewardRule)
    app.delete('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/rewardRule', rewardRule.deleteRewardRule)

    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/rewardRule/list/:filter', rewardRule.getRewardRuleList)
    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/rewardRule/type/list', rewardRule.getAllTypeList)

    app.get('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/balance/list', invoiceRetailer.getBalance);
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/voucher/invoice', invoiceRetailer.invoiceRetails)

};